import { request } from '@/utils'


// 获取-所有频道
export const getChannelsAPI = () => {
  return request({
    url: '/channels',
    method: 'GET',
  })
}

// 新增-文章
export const addArticleAPI = (data) => {
  return request({
    url: '/mp/articles?draft=false',
    method: 'POST',
    data,
  })
}

// 编辑-文章
export const updateArticleAPI = (data) => {
  return request({
    url: `/mp/articles/${data.id}?draft=false`,
    method: 'PUT',
    data,
  })
}

// 获取-文章列表
export const getArticleListAPI = (params) => {
  return request({
    url: '/mp/articles',
    method: 'GET',
    params,
  })
}

// 删除-文章
export const deleteArticleAPI = (id) => {
  return request({
    url: `/mp/articles/${id}`,
    method: 'DELETE',
  })
}

// 获取-文章详情
export const getArticleByIdAPI = (id) => {
  return request({
    url: `/mp/articles/${id}`,
    method: 'GET',
  })
}